import {withIronSession} from 'next-iron-session';
import {GetServerSideProps, NextApiHandler} from 'next';

export function withSession(handler: NextApiHandler | GetServerSideProps) {
  return withIronSession(handler, {
    // password: process.env.SECRET,
    password: `8asd6894f65a7sd98f46as5d7f984a6ds7f98a41d6s5f7`,
    cookieName: 'blog',
    cookieOptions: {secure: false}
  });
}
